package com.sitechasia.webx.components.xtable.toolbar;

import org.extremecomponents.table.core.TableModel;
import org.extremecomponents.table.view.html.BuilderUtils;
import org.extremecomponents.util.HtmlBuilder;

/**
 * 数商前台toolbar样例
 * @author Jeff Johnston
 */
public class CustomdivSSqtToolbar extends DivLayout {


	// 输入框的位置
	private String location;

	public CustomdivSSqtToolbar(HtmlBuilder html, TableModel model, String location) {
		 super(html, model);

		this.location = location;
	}

	protected boolean showLayout(TableModel model) {
        boolean showPagination = BuilderUtils.showPagination(model);
        boolean showExports = BuilderUtils.showExports(model);
        if (!showPagination && !showExports) {
            return false;
        }

        return true;
    }

	public void divToolbar(HtmlBuilder html, TableModel model)  {
		CustomToolbarBuilder toolbarBuilder = new CustomToolbarBuilder(html,
				model);

		html.div().styleClass("pagetag line").close();

		// 显示：总共13条,列出第1到第13条
		toolbarBuilder.qtStatus();

		// 显示：上页
		toolbarBuilder.prevPage("上页");

		// 显示：|
		toolbarBuilder.separatorLine();

		// 显示：下页
		toolbarBuilder.nextPage("下页");

		// 显示：第cur/total页
		toolbarBuilder.curTotalPage();

		// 显示：转到 输入框 button
		// location:输入框的位置:TOP BOTTOM
		toolbarBuilder.turnToPage("转到 ","",location);

		html.divEnd();

		html.newline();
	}

}